<?php

namespace App\Http\Resources;


//use Illuminate\Http\Resources\Json\Resource;

use App\Http\Responses\Resource;

class User extends Resource
{

    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request
     * @return array
     */
    public function toArray($request)
    {

        return [
            'nickname' => $this->nickname,
            'id' => $this->id,
            'head' => $this->head,
            'signature' => $this->signature,
            'grade' => $this->userGrade,
            'role' => $this->role,
            'authentication' => $this->authentication,
            'recommend' => $this->recommend,
            'sex' => $this->sex,
            'group' => $this->group,
            'isAuthor' => $this->is_author,
            'following' => $this->following()->where('status','!=',1)->count(),
            'fans' => $this->fans()->where('status','!=',1)->count()

        ];


    }
}
